(function(app){
	app
		.controller("content_select_otherCtrl",["$scope","myFactory",'$http','$stateParams','$state','$q',function($scope,myFactory,$http,$stateParams,$state,$q){
			//接收从查询页面传送过来的查询条件
			var searchParam = $stateParams.searchParam;
			var chdrnum01 = $stateParams.chdrnum01;
			var chdrcoy = $stateParams.chdrcoy;//保单公司号码
			var flag1 = false;//因为该页面涉及两个初始化函数，有异步关系，不好做加载圈，设置两个标志用于检测是否都完成了
			var flag2 = false;
			var initFlag = false;//总体检测标志，在两个初始化函数完成后，会被置为true
			var token=sessionStorage.getItem("token");
	    //S2018122906735移动保全新增变更项目及功能的优化需求 add by mqz 20191225 start 
			var isCanChange=false; //判断是否可以做变更
	    //S2018122906735移动保全新增变更项目及功能的优化需求 add by mqz 20191225 end
		  //绑定到页面
			$scope.chdrnum01 = $stateParams.chdrnum01;
			
			//参数定义
			var policyData="";   //保单详情接收参数
			var initSelectItemData=""; //初始化变更项目数据
			var userPassItem=""; //用户初始化变更项目权限（即是哪些变更项目是有权限的，不过并非没权限就无法运行，而是显示灰色）

			$scope.load = function () {
				console.log("chdrnum01:"+chdrnum01+",chdrcoy:"+chdrcoy);
				//初始化函数：
				myFactory.loadingShow();//显示加载圈
				$scope.loadBdDetail();
				$scope.loadBgDetail();
			}
			
			$scope.loadBdDetail = function () {
				var timestamp=myFactory.getTimetamp();
				var sfis= "chdrnum-chdrcoy-token-timestamp";
				var signStr="chdrnum="+chdrnum01+"&chdrcoy="+chdrcoy+"&token="+token+"&timestamp="+timestamp;//encodeURI(tbrName)
				var sign = myFactory.hex(signStr);
				//查询保单详情信息
				$http({
					method: 'GET',
					url: app.domain + 'query/doRestPolicyDetail.action',
					params: {'chdrnum': chdrnum01,'chdrcoy': chdrcoy,'sign':sign,'sfis':sfis,'token':token,'timestamp':timestamp}
				}).then(function successCallback(response) {
					if (response.data.success) {
						policyData = response.data.data.policyMap.base;
						flag1 = true;//表明第一个初始化函数加载完成
					}
					if(flag1 && flag2){ //判断是否隐藏加载圈，如果第二个函数先完成了，那么flag2=true，这里则会执行隐藏
						initFlag = true;
						myFactory.loadingHide();
					}
				}, function errorCallback(response) {
					myFactory.loadingHide();//失败时候直接隐藏加载圈，用户才可以点返回然后重新进入
					myFactory.alert("","查询数据失败!","info");
				});
			}
			
			$scope.loadBgDetail = function () {
				var timestamp=myFactory.getTimetamp();
				var sfis= "chdrnum-chdrcoy-token-timestamp";
				var signStr="chdrnum="+chdrnum01+"&chdrcoy="+chdrcoy+"&token="+token+"&timestamp="+timestamp;//encodeURI(tbrName)
				var sign = myFactory.hex(signStr);
				//查询初始化变更项目数据
				$http({
					method: 'GET',
					url: app.domain + 'input/restInitSelectItem.action',
					params: {'chdrnum': chdrnum01,'chdrcoy': chdrcoy,'sign':sign,'sfis':sfis,'token':token,'timestamp':timestamp}
				}).then(function successCallback(response) {
					if (response.data.success) {
						initSelectItemData = response.data.data.modelMap;
						userPassItem = response.data.data.modelMap.userPassItem;
						var items = $("p[name='item']");  //	页面p标签中所有变更项编号值
					  	var len = items.length;
						for( var i=0 ; i<len ; i++ ){
							var tempId = items[i].id ;	//	当前变更项编号 
							if( tempId == '02_1' || tempId == '02_2' ){
								tempId = '02';
							} 
							if( tempId == '12_42' ){
								tempId = '12';
							} 
							
							//根据权限改变变更项目的字体颜色
							$("#"+items[i].id).removeClass('not_allow').addClass('weui-grid__label');//默认有该样式
							if(userPassItem.indexOf(tempId)<=-1){ //如果在权限中找不到该变更项标志
								$("#"+items[i].id).addClass('not_allow');
							}
						}
						flag2 = true;
					}
					if(flag1 && flag2){ //判断是否隐藏加载圈
						initFlag = true;
						myFactory.loadingHide();
					}
				}, function errorCallback(response) {
					myFactory.loadingHide();
					myFactory.alert("","查询数据失败!","info");
				});
			}
			
			//重新更新 初始化变更项目数据
			function reNewSelectItemData(){
				var timestamp=myFactory.getTimetamp();
				var sfis= "chdrnum-chdrcoy-token-timestamp";
				var signStr="chdrnum="+chdrnum01+"&chdrcoy="+chdrcoy+"&token="+token+"&timestamp="+timestamp;//encodeURI(tbrName)
				var sign = myFactory.hex(signStr);
				var deferred = $q.defer();//声明承诺
				$http({
					method: 'GET',
					url: app.domain + 'input/restInitSelectItem.action',
					params: {'chdrnum': chdrnum01,'chdrcoy': chdrcoy,'sign':sign,'sfis':sfis,'token':token,'timestamp':timestamp}
				}).then(function successCallback(response) {
					if (response.data.success) {
						initSelectItemData = response.data.data.modelMap;
					}
					deferred.resolve(response);//请求成功
				}, function errorCallback(response) {
					myFactory.alert("","查询数据失败!","info");
					myFactory.loadingHide();
				});
				return deferred.promise;//返回承诺
			}
			
			$scope.data = {
				change: [
					{
						project: '基本信息类：',
						list: [
							{
								changeTypeId: '04',
								title: '缴费方式',
								src: 'images/grid/others/1.png',
								methor: "content_04_input({changeTypeId:04,chdrnum01:"+chdrnum01+"})",
								allow: true
							},
							{
								changeTypeId: '06',
								title: '保费逾期未付',
								src: 'images/grid/others/2.png',
								methor: "communication_data_change({changeTypeId:06,chdrnum01:"+chdrnum01+"})",
								allow: true
							},
							{
								changeTypeId: '02_2',
								title: '终止续期转账',
								src: 'images/grid/others/14.png',
								methor: "communication_data_change({changeTypeId:32,chdrnum01:"+chdrnum01+"})",
								allow: true
							},
							{
								changeTypeId: '37',
								title: '补缴保障费用',
								src: 'images/grid/others/8.png',
								methor: "communication_data_change({changeTypeId:26,chdrnum01:"+chdrnum01+"})",
								allow: true
							},
							{
								changeTypeId: '36',
								title: '进入缓缴期',
								src: 'images/grid/others/12.png',
								methor: "communication_data_change({changeTypeId:30,chdrnum01:"+chdrnum01+"})",
								allow: true
							},
							{
								changeTypeId: '03',
								title: '变更签名',
								src: 'images/grid/others/13.png',
								methor: "communication_data_change({changeTypeId:31,chdrnum01:"+chdrnum01+"})",
								allow: true
							}
							/*S2022011120945屏蔽移动保全、官微、官网系统中的保全变更项目“续期缴费通知选择” add by huanghaokun 20220207 start*/
							/*,
							{
								changeTypeId: '35',
								title: '补发保单',
								src: 'images/grid/others/7.png',
								methor: "content_35_input({changeTypeId:35,chdrnum01:"+chdrnum01+"})",
								allow: true
							}*/
							/*S2022011120945屏蔽移动保全、官微、官网系统中的保全变更项目“续期缴费通知选择” add by huanghaokun 20220207 end*/
							
							/*S2020010811503 保全变更项目需取消“补发寰宇卡附加值服务卡”选项 add by yangyan 20200113 start*/
							/*,
							{
								changeTypeId: '12_42',
								title: '补发客户卡',
								src: 'images/grid/others/9.png',
								methor: "content_12_42_input({changeTypeId:12_42,chdrnum01:"+chdrnum01+"})",
								allow: true
							},*/
							/*S2020010811503 保全变更项目需取消“补发寰宇卡附加值服务卡”选项 add by yangyan 20200113 end*/
						]
					},
					{
						project: '权益/领取类：',
						list: [
							{
								changeTypeId: '39',
								title: '生存给付确认',
								src: 'images/grid/others/4.png',
								methor: "communication_data_change({changeTypeId:22,chdrnum01:"+chdrnum01+"})",
								allow: true
							},
							{
								changeTypeId: '47',
								title: '领取生存金',
								src: 'images/grid/rights/2.png',
								methor: "content_47_input({changeTypeId:47,chdrnum01:"+chdrnum01+"})",
								allow: true
							},	
							{
								changeTypeId: '43',
								title: '领取满期金',   //满期给付确认
								src: 'images/grid/rights/6.png',
								methor: "communication_data_change({changeTypeId:43,chdrnum01:"+chdrnum01+"})",
								allow: true
							},
							{
								changeTypeId: '40',
								title: '生存领取方式',
								src: 'images/grid/others/6.png',
								methor: "communication_data_change({changeTypeId:24,chdrnum01:"+chdrnum01+"})",
								allow: false
							},
							{
								changeTypeId: '50',
								title: '年金领取方式',
								src: 'images/grid/others/11.png',
								methor: "communication_data_change({changeTypeId:29,chdrnum01:"+chdrnum01+"})",
								allow: true
							},
							{
								changeTypeId: '34',
								title: '终止合同结清',
								src: 'images/grid/rights/5.png',
								methor: "communication_data_change({changeTypeId:34,chdrnum01:"+chdrnum01+"})",
								allow: true
							}
						]
					},
					{
						project: '投资变更类：',
						list: [
							{
								changeTypeId: '17',
								title: '额外投资',
								src: 'images/grid/invest/1.png',
								methor: "communication_data_change({changeTypeId:17,chdrnum01:"+chdrnum01+"})",
								allow: true
							},						
							{
								changeTypeId: '20',
								title: '续期投资账户选择',
								src: 'images/grid/invest/2.png',
								methor: "communication_data_change({changeTypeId:20,chdrnum01:"+chdrnum01+"})",
								allow: true
							},
							{
								changeTypeId: '21',
								title: '部分提取',
								src: 'images/grid/invest/3.png',
								methor: "communication_data_change({changeTypeId:21,chdrnum01:"+chdrnum01+"})",
								allow: true
							},							
						]
					/*******S2018122906735 移动保全新增变更项目及功能的优化需求  add by huanghaokun 20200221  start*******/
					},
					{
						project: '保险计划类：',
						list: [
							{
								changeTypeId: '15',
								title: '保险计划',
								src: 'images/grid/others/15.png',
								methor: "communication_data_change({changeTypeId:15,chdrnum01:"+chdrnum01+"})",
								allow: true
							},
							{
								changeTypeId: '29',
								title: '取消承保条件',
								src: 'images/grid/others/29.png',
								methor: "communication_data_change({changeTypeId:29,chdrnum01:"+chdrnum01+"})",
								allow: true
							},
							{
								changeTypeId: '30',
								title: '补充告知',
								src: 'images/grid/others/30.png',
								methor: "communication_data_change({changeTypeId:30,chdrnum01:"+chdrnum01+"})",
								allow: true
							}
					     ]
					}
					/*******S2018122906735 移动保全新增变更项目及功能的优化需求  add by huanghaokun 20200221  end*******/

				]				
			}

			
			//返回函数
			$scope.goBack = function () {
				myFactory.goBack();
			}
			

			//公用变量初始化
			var _lasFlag = "Y" ;	//	LAS检验标志
			var _itemMutual = "Y" ;		//	变更项互斥值
			var _checkBeneTerm = "Y" ;	//	检测受益人条款约定
			var _backReceipt = "Y" ;	//	回执回访结果
			var exictItems;
			
			//变更项目跳转判定
			$scope.show = function(changeTypeId){

				/*********************************************系统开放功能begin***************************************/

				/*if(app.openFlag=='openAll'){
					console.log("Permission：开发人员");
					//直接通过
				}else if(app.openFlag=='openTest'){
					console.log("Permission：测试人员");
					//01:通讯方式,,35:补发保单,36:进入缓缴期,02_2:终止续期转账,02_1:续期账户,12_42:补发客户卡,10:身份信息,19:投资账户转换
					//var isTestFunction = new Array("01","35","36","02_2","02_1","12_42","10","19");//第一阶段

					//03变更签名、05红利领取方式、54信函接收方式、08身故受益人
					//27退保、50变更年金领取方式、38保单还款、39生存给付确认、45领取现金红利、33结束保险费缓缴期、28保单借款
					//var isTestFunction = new Array("01","35","36","02_2","02_1","12_42","10","19","03","05","54","08","27","50","38","39","45","33","28");//第一、二阶段

					//第三阶段
					//39生存给付确认，43满期给付确认，04缴费方式，37补缴保障费用，17额外投资，47领取生存金，06保费逾期未付，52续期缴费通知，20续期投资账户选择，34终止合同结清，21部分提取，55犹豫期退保，40生存给付资料变更,23复效
					var isTestFunction = new Array("01","35","36","02_2","02_1","12_42","10","19","03","05","54","08","27","50","38","39","45","33","28","39","43","04","37","17","47","06","52","20","34","21","55","40","23");//第一、二、三阶段

					var permission='N';
					for(var i=0;i<isTestFunction.length;i++){
						var noPermission=isTestFunction[i];
						if(changeTypeId==noPermission){
							permission='Y';
							console.log("noPermission：测试人员,past:"+noPermission);
							break;
						}
					}
					if(permission=='N'){
						myFactory.alert("","功能调整中,请耐心等待!","info");
						return false;
					}
				}else{
					myFactory.alert("","功能调整中,请稍候再试!","info");
					return false;
				}*/
				/*********************************************系统开放功能end***************************************/

				//判断是否初始化完成了，如果失败，不予进入项目
				if(!initFlag){
					myFactory.alert("","初始化时失败，请返回上一步重试","info");
					return;
				}
				myFactory.loadingShow();//显示加载圈
				
				var promiseDistrict = reNewSelectItemData();
				promiseDistrict.then(function success(returnDistrict) {//成功回调
					//进行项目变更时候的一些参数读取
					var s = policyData.statcode01; //保单类型代码
					var slock = policyData.lcksts;	//SOFTLOCK标志
					var pstatcode01 = policyData.pstatcode01; //保费状态（代码）
					var type = policyData.productType;//产品类型(投连U、万能W、投连万能U,W)
					var sprovid = policyData.sprovid; ////保单地区编码
					var message = "";//用于前端返回信息
					var state = "";//跳转路由
			    //S2018122906735移动保全新增变更项目及功能的优化需求 add by mqz 20191225 start 
					var timestamp=myFactory.getTimetamp();
					var sfis= "chdrnum-chdrcoy-token-timestamp";
					var signStr="chdrnum="+chdrnum01+"&chdrcoy="+chdrcoy+"&token="+token+"&timestamp="+timestamp;//encodeURI(tbrName)
					var sign = myFactory.hex(signStr);
	        //S2018122906735移动保全新增变更项目及功能的优化需求 add by mqz 20191225 end
				  	exictItems = initSelectItemData.strItemIds;	//	本次变更中所存在的全部变更项
			     	
				  	//S2023072426818-PIC_保稳盈个人养老金平台营运系统需求 add by huanghk 20230906 start
				  	var gyCode = initSelectItemData.gyCode;
				  	//S2023103027791个人养老年金项目保全系统优化需求 update by huanghk 20231103 start
				  	var feeItems = "04,05,17,21,23,28,33,34,37,38,39,40,43,45,47,15,29,30";
				  	//S2023103027791个人养老年金项目保全系统优化需求 update by huanghk 20231103 end
				  	console.log("个养标识："+gyCode);
			     	if(gyCode=="Y" && feeItems.indexOf(changeTypeId)>-1){
						message = '暂不支持个人养老金保单操作';
						tipMessage(message);
					}else{
						if(changeTypeId=="03"){//签名样式变更
			     		if((s=="IF"||s=="PU"||s=="MA")&& slock=="N"){
			     			state = "content_03_input";
							ExictItem(changeTypeId,type,state);
						}else {
							alterMessage(message);
						}
			     	} 
				  	if(changeTypeId=="06"){//保费逾期未付选择  
			     		if((s=="IF")&& slock=="N"&&(type=="L"||type=="P"||type=="H")){
			     			state = "content_06_input";
							ExictItem(changeTypeId,type,state);
						}else {
							alterMessage(message);
						}
			     	}
				  	/*S2022011120945屏蔽移动保全、官微、官网系统中的保全变更项目“续期缴费通知选择” add by huanghaokun 20220207 start*/
				  	/*if(changeTypeId=="35"){//保单补发
			     		if((s=="IF"||s=="PU") && slock=="N"){
							state = "content_35_input";
							ExictItem(changeTypeId,type,state);
						}else {
							alterMessage(message);
						}
			     	}*/
				  	/*S2022011120945屏蔽移动保全、官微、官网系统中的保全变更项目“续期缴费通知选择” add by huanghaokun 20220207 end*/
			     	if(changeTypeId=="12_42"){//补发附加值服务卡
			     		//if((s=="IF"||s=="PU"||s=="MA"||s=="NT"||s=="LA")&& slock=="N"){
			     		if((s=="IF"||s=="PU")&& slock=="N"){
							state = "content_12_42_input";
							ExictItem(changeTypeId,type,state);
						}else {
							alterMessage(message);
						}
			     	}
			     	if(changeTypeId=="17"){//额外投资
			     		if((s=="IF")&& slock=="N"&&(type=="U"||type=="W")){
			     			state = "content_17_input";
							ExictItem(changeTypeId,type,state);
						}else {
							alterMessage(message);
						}
			     	}
			     	if(changeTypeId=="20"){//投资账户选择
			     		if((s=="IF")&&type=="U"&& s!="LA"&&s!="MP" &&pstatcode01!="SP"&& slock=="N"){
			     			state = "content_20_input";
							ExictItem(changeTypeId,type,state);
						}else {
							alterMessage(message);
						}
			     	}
			     	if(changeTypeId=="21"){//部分提取(待检查)保单状态为IF状态的投连、万能保单（产品类型为U、W）
			     		if((s=="IF")&& slock=="N"&&(type=="W"||type=="U")){
			     			state = "content_21_input";
							ExictItem(changeTypeId,type,state);
						}else {
							alterMessage(message);
						}
			     	}
			     	if(changeTypeId=="52"){//续期缴费通知选择
			     		if((s=="IF")&& slock=="N"){
							ExictItem(changeTypeId,type,state);
						}else {
							alterMessage(message);
						}
			     	}
			     	if(changeTypeId=="54"){//变更信函接收方式
			     		if((s=="IF"||s=="PU"||s=="LA")&& slock=="N"){
							ExictItem(changeTypeId,type,state);
						}else {
							alterMessage(message);
						}
			     	}
			     	if(changeTypeId=="06"){//保费逾期未付选择
			     		if((s=="IF")&& slock=="N"&&(type=="L"||type=="P"||type=="H")){
							ExictItem(changeTypeId,type,state);
						}else {
							alterMessage(message);
						}
			     	}
			     	if(changeTypeId=="50"){//年金领取方式变更(待检查)保单状态为IF状态的年金保单
			     		if((s=="IF")&& slock=="N"){
			     			state="content_50_input";
							ExictItem(changeTypeId,type,state);
						}else {
							alterMessage(message);
						}
			     	}			     		     	
			     	
			     	if(changeTypeId=="36"){//进入保险费缓缴期
			     		if((s=="IF")&& slock=="N"){
			     			state = "content_36_input";
							ExictItem(changeTypeId,type,state);
						}else {
							alterMessage(message);
						}
			     	}
			     	
			     	if(changeTypeId=="02_2"){//终止续期转账授权申请
			     		if((s=="IF")&& slock=="N"){
			     			state = "content_02_2_input";
			     			if(exictItems.indexOf("02_1")>-1){ //如果已经做了变更续期转账账户，则不允许做这个流程
			     				alterMessage(message);
							}else{
								ExictItem(changeTypeId,type,state);
							}
						}else {
							alterMessage(message);
						}
			     	}
			     	
			     	if(changeTypeId=="04"){//缴别变更(缴费方式变更)
			     		if((s=="IF"||pstatcode01=="PP")&&s!="PU"&&s!="MA"&&s!="NT"&&s!="LA"&&s!="MP"&& slock=="N"){
							state = "content_04_input";
							ExictItem(changeTypeId,type,state);
						}else {
							alterMessage(message);
						}
			     	}
		
			     	if(changeTypeId=="37"){//补缴保障费用和保单管理费
			     		if((s=="IF")&& slock=="N"&&(type=="W"||type=="U")){
			     			state="content_37_input";
							ExictItem(changeTypeId,type,state);
						}else {
							alterMessage(message);
						}
			     	}
			     
			     	if(changeTypeId=="05"){//红利领取方式变更
			     		if( s=="IF" && slock=="N" && type=="P" ){
							ExictItem(changeTypeId,type,state);
						}else {
							alterMessage(message);
						}
			     	}
			    
			     	if(changeTypeId=="39"){//生存给付确认(待检查)保单状态为IF状态的生存金、年金保单
			     		if((s=="IF")&& slock=="N"){
			     			state="content_39_input";
							ExictItem(changeTypeId,type,state);
						}else {
							alterMessage(message);
						}
			     		/*state="content_39_input";
						myFactory.loadingHide();
						$state.go(state,{
							changeTypeId:'39',
							chdrnum01:chdrnum01,
							chdrcoy:chdrcoy,
							searchParam:searchParam
						});*/
			     	}
			     	if(changeTypeId=="40"){//生存给付资料变更   生存领取方式      保单状态为IF状态的生存金保单
			     		if((s=="IF")&& slock=="N"){
			     			state="content_40_input";
							ExictItem(changeTypeId,type,state);
						}else {
							alterMessage(message);
						}
			     	}
			     	if(changeTypeId=="43"){//领取满期金   满期给付确认
			     		if((s=="MA")&& slock=="N"){
			     			state="content_43_input";
							ExictItem(changeTypeId,type,state);
						}else {
							alterMessage(message);
						}
			     	}
			     	if(changeTypeId=="33"){//年金领取方式变更(待检查)保单状态为IF状态的保单
			     		if((s=="IF"&&pstatcode01=="PH")&& slock=="N"&&(type=="U"||type=="W")){			     		
			     			state="content_33_input";
							ExictItem(changeTypeId,type,state);
						}else {
							alterMessage(message);
						}
			     	}
					if(changeTypeId=="34"){//终止合同结清
						//if((s=="IF"&&pstatcode01=="PH")&& slock=="N"&&(type=="U"||type=="W")){
						if((s=="NT")&& slock=="N"){
							state="content_34_input";
							ExictItem(changeTypeId,type,state);
						}else {
							alterMessage(message);
						}
						//Test
						//state="content_34_input";
						//ExictItem(changeTypeId,type,state);
					}
					if(changeTypeId=="47"){//领取生存金
						//if((s=="IF"&&pstatcode01=="PH")&& slock=="N"&&(type=="U"||type=="W")){
						if((s=="IF")&& slock=="N"){
							state="content_47_input";
							ExictItem(changeTypeId,type,state);
						}else {
							alterMessage(message);
						}
						//Test
						//state="content_47_input";
						//ExictItem(changeTypeId,type,state);
					}

					//S2018122906735移动保全新增变更项目及功能的优化需求 add by mqz 20191225 start 
					if(changeTypeId=="15"){//保险计划
						if((s=="IF")&& slock=="N"){
							$http({
								method: 'GET',
								url: app.domain + 'common/isCanDoChange.action',
							    params: {'itemId':'15','chdrnum': chdrnum01,'chdrcoy': chdrcoy,'sign':sign,'sfis':sfis,'token':token,'timestamp':timestamp}
							}).then(function successCallback(response) {
								if (response.data.success) {
									isCanChange  =response.data.data.isCanDoChange;
								}
								
								if(isCanChange&& slock=="N"){
						  		    //访问模块
					     			state = "content_15_input";//新增页面
					     			ExictItem(changeTypeId,type,state);
						  		}else {
									alterMessage(message);
								}
								myFactory.loadingHide();
							}, function errorCallback(response) {
								myFactory.loadingHide();
								myFactory.alert("","初始化查询变更项内容失败!","info");
							});
						}else {
							alterMessage(message);
						}
						
				  		
			     	}
					if(changeTypeId=="29"){//保承
						if((s=="IF"||s=="PU") && slock=="N"){
							$http({
								method: 'GET',
								url: app.domain + 'common/isCanDoChange.action',
							    params: {'itemId':'29','chdrnum': chdrnum01,'chdrcoy': chdrcoy,'sign':sign,'sfis':sfis,'token':token,'timestamp':timestamp}
							}).then(function successCallback(response) {
								if (response.data.success) {
									isCanChange  =response.data.data.isCanDoChange;
								}
								if(isCanChange&& slock=="N"){
									 //访问模块
					     			state = "content_29_input";//新增页面
					     			ExictItem(changeTypeId,type,state);
						  		}else {
									alterMessage(message);
								}
								myFactory.loadingHide();
							}, function errorCallback(response) {
								myFactory.loadingHide();
								myFactory.alert("","初始化查询变更项内容失败!","info");
							});
						}else {  
							alterMessage(message);  
						}  
						
			     	}
					if(changeTypeId=="30"){//补充告知
						if((s=="IF")&& slock=="N"){
							$http({
								method: 'GET',
								url: app.domain + 'common/isCanDoChange.action',
							    params: {'itemId':'30','chdrnum': chdrnum01,'chdrcoy': chdrcoy,'sign':sign,'sfis':sfis,'token':token,'timestamp':timestamp}
							}).then(function successCallback(response) {
								if (response.data.success) {
									isCanChange  =response.data.data.isCanDoChange;
								}
								if(isCanChange&& slock=="N"){
						  		    //访问模块
					     			state = "content_30_input";//新增页面
					     			ExictItem(changeTypeId,type,state);
						  		}else {
									alterMessage(message);
								}
								myFactory.loadingHide();
							}, function errorCallback(response) {
								myFactory.loadingHide();
								myFactory.alert("","初始化查询变更项内容失败!","info");
							});
						}else {
							alterMessage(message);
						}
						
			     	}
				  	//S2018122906735移动保全新增变更项目及功能的优化需求 add by mqz 20191225 end 
					}
					//S2023072426818-PIC_保稳盈个人养老金平台营运系统需求 add by huanghk 20230906 end
				},function error(errDistrict) {//错误回调
					myFactory.alert("","更新初始化变更项目数据失败!","info");
					myFactory.loadingHide();
				});
			}
			
			function alterMessage(message){
				message = '保单险种或状态不符，暂不允许该变更项目，请重新确认!';
				$.alert({
					 title: '',
					 text: message,
					 onOK: function () {
					 //点击确认
					 }
				});
				myFactory.loadingHide();//关闭加载圈
			}
			
			//S2023072426818-PIC_保稳盈个人养老金平台营运系统需求 add by huanghk 20230906 start
			function tipMessage(message){
				$.alert({
					 title: '',
					 text: message,
					 onOK: function () {
					 //点击确认
					 }
				});
				myFactory.loadingHide();//关闭加载圈
			}
			//S2023072426818-PIC_保稳盈个人养老金平台营运系统需求 add by huanghk 20230906 end
			
			
			//保单状态值校验成功后
			function ExictItem(id,type,state){
				console.log("测试");
				_lasFlag = "Y" ;	//	初始化为Y
				_checkBeneTerm = "Y" ;	//	初始化为Y
				_backReceipt = "Y" ;	//	初始化为Y
				_backReceipt = "Y" ;	//	初始化为Y
				var timestamp=myFactory.getTimetamp();
				var sfis= "itemId-productType-token-timestamp";
				var signStr="itemId="+id+"&productType="+type+"&token="+token+"&timestamp="+timestamp;//encodeURI(tbrName)
				var sign = myFactory.hex(signStr);
				$http({
					method: 'GET',
					url: app.domain + '/common/restCheckForItem.action',
					params: {'itemId':id,'productType':type,'sign':sign,'sfis':sfis,'token':token,'timestamp':timestamp}
				}).then(function successCallback(response) {
					if (response.data.success) {
						/*console.log(response.data.data.checkLAS);
						console.log(response.data.data.checkItemMutual);
						console.log(response.data.data.checkBeneTerm);
						console.log(response.data.data.doBackReceipt);*/
						_lasFlag = response.data.data.checkLAS;
						_itemMutual = response.data.data.checkItemMutual;
						if(response.data.data.checkBeneTerm!=null && response.data.data.checkBeneTerm!=""){
							_checkBeneTerm = response.data.data.checkBeneTerm;
						}
						if(response.data.data.doBackReceipt!=null && response.data.data.doBackReceipt!=""){
							_backReceipt = response.data.data.doBackReceipt;
						}

						//经常加班到10点以上，暂时除去该控制，rqyang 20170807
						//LAS检查结果
						if( "N" ==  _lasFlag ){
							$.alert({
								 title: '',
								 text: '晚上22点至次日8点为公司日结作业时间段，日结期间系统暂停服务，不便之处，敬请谅解!',
								 onOK: function () {
								 //点击确认
								 }
							});
							myFactory.loadingHide();
							return;
						}
						
						
						//变更项互斥检查结果
						var messageTitle = "";
						//提示[ER01 - 退保、犹豫期退保只能与通讯资料变更一起做]
						if( "ER01" ==  _itemMutual ){
							messageTitle = "不能同时受理此变更项目!";	//	退保、犹豫期退保只能与通讯资料变更一起做
						}
						//	提示[ER02 - 不能同时变更收费、退费项目]
						if( "ER02" ==  _itemMutual ){
							messageTitle = "不能同时受理此变更项目!";	//	 同一次变更只能有一个涉及收、退费的项目
						}
						//	提示[ER03 - 本次变更已经存在收费或退费项目，不能进行投资账户转换变更]
						if( "ER03" ==  _itemMutual ){
							messageTitle = "不能同时受理此变更项目!";	//	本次变更已经存在收费或退费项目，不能进行投资账户转换变更
						}
						//S2018122906735移动保全新增变更项目及功能的优化需求 add by mqz 20200901 start
						if( "ER04" ==  _itemMutual ){
							messageTitle = "不能同时受理此变更项目!";	//	保险类和投资类变更项目不能同时变更
						}
						if( "ER05" ==  _itemMutual ){
							messageTitle = "不能同时受理此变更项目!";	//	本次变更已经存在收费或退费项目，不能进行投资账户转换变更
						}
						//S2018122906735移动保全新增变更项目及功能的优化需求 add by mqz 20200901 end
						//	异常提示
						if( "ERROR" == _itemMutual ){
							messageTitle = "互斥规则校验异常!";	//	异常处理
						}
						//如果存在以上四种情况，则弹出告示，否则不做操作
						if( "ER01" ==  _itemMutual 
							|| "ER02" ==  _itemMutual
							|| "ER03" ==  _itemMutual
							//S2018122906735移动保全新增变更项目及功能的优化需求 add by mqz 20200901 start
							|| "ER04" ==  _itemMutual
					    || "ER05" ==  _itemMutual
							//S2018122906735移动保全新增变更项目及功能的优化需求 add by mqz 20200901 end
							|| "ERROR" == _itemMutual){
							$.alert({
								 title: '',
								 text: messageTitle,
								 onOK: function () {
								 //点击确认
								 }
							});
							myFactory.loadingHide();
							return;
						}
						
						
						//检测受益人条款约定
						//提示[ER01 - 退保、犹豫期退保只能与通讯资料变更一起做]
						if( "N" ==  _checkBeneTerm ){
							$.alert({
								 title: '',
								 text: '保单险种或状态不符，暂不允许该变更项目，请重新确认!',
								 onOK: function () {
								 //点击确认
								 }
							});
							myFactory.loadingHide();
							return;
						}
						if( "ERROR" == _checkBeneTerm ){
							$.alert({
								 title: '',
								 text: '检测受益人条款约定出现异常!',
								 onOK: function () {
								 //点击确认
								 }
							});
							myFactory.loadingHide();
							return;
						}
						
						
						//检测保单回执回访结果
						//	提示[N - 回执或回访未完成]
						if( "N" ==  _backReceipt ){
							$.alert({
								 title: '',
								 text: '保单回执未签回/回访未完成，请先签署回执/完成回访后再申请本次变更!',
								 onOK: function () {
								 //点击确认
								 }
							});
							myFactory.loadingHide();
							return;
						}
						//	异常提示
						if( "ERROR" ==  _backReceipt ){
							$.alert({
								 title: '',
								 text: '检测保单回执回访结果异常!',
								 onOK: function () {
								 //点击确认
								 }
							});
							myFactory.loadingHide();
							return;
						}
						
						
						//判断是否曾经变更过 
						if(exictItems.indexOf(id)>-1){
							$.confirm("是否需修改变更内容", "", function() {
								myFactory.loadingHide();
								$state.go(state,{
									changeTypeId:id,
									chdrnum01:chdrnum01,
									chdrcoy:chdrcoy,
									searchParam:searchParam
								});
							}, function() {
								myFactory.loadingHide();//按了取消不做操作
							});
						}else{
							myFactory.loadingHide();
							$state.go(state,{
								changeTypeId:id,
								chdrnum01:chdrnum01,
								chdrcoy:chdrcoy,
								searchParam:searchParam
							});
						}		
					}
				}, function errorCallback(response) {
					myFactory.alert("","查询数据失败!","info");
					myFactory.loadingHide();
				});
			}
			
		}])
})(app)